#include"log.h"

int InitLog(const char *log_dir)
{
    if(opendir(log_dir) == NULL)
    {
        if(mkdir(log_dir,0755)  == -1)
        {
            return -1;
        }
    }
    openlog("NetDisk",LOG_CONS|LOG_PID,0);
    char *log_path = (char *)malloc(strlen(log_dir) + 10);
    sprintf(log_path,"%s%s",log_dir, "sys.log");
    if(symlink("/var/log/syslog","log/sys.log") != 0 &&errno != EEXIST )
    {
        return -1;
    }
}

void DeInitLog()
{
    closelog();
}
